package at.fhj.swd.pse.entities;

import javax.persistence.Column;
import javax.persistence.Entity;

@Entity
public class UserActivity extends Activity {

	/**
    * 
    */
	private static final long serialVersionUID = 1L;
	@Column
	private String message;

	public String getMessage() {
		return this.message;
	}

	public void setMessage(final String message) {
		this.message = message;
	}

	@Override
	public String toString() {
		String result = this.getClass().getSimpleName() + " ";
		result += "serialVersionUID: " + serialVersionUID;
		if ((this.message != null) && !this.message.trim().isEmpty()) {
			result += ", message: " + this.message;
		}
		return result;
	}

	@Override
	public String getHtmlDescription() {
		if (super.getCreator() != null) {
			return super.getCreator().getFirstName() + " " + super.getCreator().getFirstName() + ": " + this.message;
		}
		return this.message;
	}

	@Override
	public String getHtmlTargetUrl() {
		if (super.getCreator() != null) {
			return "?userId=" + super.getCreator().getId();
		}
		return "?userId=-1";
	}
}
